export const PUBLIC = {
	formatTime: (timestr) => {
		if (!timestr) return ''
		let year = timestr.substring(0, 4)
		let date = timestr.substring(4, 6) + '-' + timestr.substring(6, 8)
		let time = timestr.substring(8, 10) + ':' + timestr.substring(10, 12)
		let currentD = new Date()
		let currentDay = currentD.getFullYear() + ' ' + (currentD.getMonth() + 1) + '-' + currentD.getDate()
	
		if (new Date(currentDay).getTime() === new Date(year + ' ' + date).getTime()) {
			return time
		} else {
			return date + ' ' + time
		}
	},
	getNowTimeStr() {
		let now = new Date()
		let year = now.getFullYear()
		let month = now.getMonth() + 1
		if (month.length < 2) {
			month = '0' + month
		}
		let date = now.getDate()
		if (date.length < 2) {
			date = '0' + date
		}
		let hours = now.getHours()
		let minutes = now.getMinutes()
		let seconds = now.getSeconds()
		let milliseconds = now.getMilliseconds()
		return '' + year+month+date+hours+minutes+seconds+milliseconds
	}
}